package com.huluobo.a2201mvvm_imdemo.conversation;

import androidx.lifecycle.MutableLiveData;

import com.huluobo.a2201mvvm_imdemo.mvvm.BaseRepo;
import com.hyphenate.chat.EMConversation;

import java.util.Map;

/**
 * Created by LC on 2024/4/2.
 */
public class ConversationRepo extends BaseRepo {
    public void loadConversations(MutableLiveData<Map<String, EMConversation>> success,
                                  MutableLiveData<String> failed) {
        Map<String, EMConversation> allConversations = emClient.chatManager().getAllConversations();
        if (allConversations.size() != 0) {
            success.postValue(allConversations);
        } else {
            failed.postValue("获取会话列表失败");
        }
    }
}
